import React,{Component} from 'react';
import ReactDOM from 'react-dom';
import Dialog from './base.dialog.js';
import $ from 'jquery';

export default class DialogCenter extends Component{
    constructor(props){
        super(props);
    }
    appendToBody() {
        console.info(ReactDOM);
        ReactDOM.unstable_renderSubtreeIntoContainer(
            this,
            <Dialog title="this is  a title!" onClickCancle={this.props.onClickCancle.bind(this)}>
                <span>这是内容内容内容</span>
            </Dialog>,
            this.container
        )
    }
    componentDidMount() {
        this.container = document.createElement('div');
        $(this.container).addClass("global-hide");
        document.body.appendChild(this.container);
        this.appendToBody()
    }
    componentDidUpdate() {
        this.appendToBody()
    }
    componentWillUnmount() {
        document.body.removeChild(this.container)
    }
    render(){
        return null;
    }
}
